
import javax.swing
from net.sf.jtreemap.swing import *
import net
import MatrixIO;
from Matrix import *;
import java


# split by gene which really isn't a strategy.. 
class GeneSplitStrategy(net.sf.jtreemap.swing.SplitStrategy):
	def calculatePositions(tree):
		pass
	

[E,Elabels,ExpLabels] = MatrixIO.readmatrix('Etest.txt');
builder = TreeMapNodeBuilder();
[genes,exps] = size(E);
genes=10
rootNode = builder.buildBranch('root',None)
t = builder.buildBranch("branch1", rootNode);

for y in xrange(1,exps):
	branch = builder.buildBranch(ExpLabels[y],t)
	for x in xrange(1,genes):
		builder.buildLeaf(Elabels[x], 1,DefaultValue(E[x,y]), branch);


tree = JTreeMap(builder.getRoot())
net.sf.jtreemap.swing.provider.RedGreenColorProvider(tree)

win = javax.swing.JFrame()
win.getContentPane().add(tree)
win.setVisible(True)
tree.setVisible(True)
tree.show()
win.pack()
win.show()

print "this should work"